//
//  JGMessageController.m
//  JGRider
//
//  Created by 单启志 on 2018/1/26.
//  Copyright © 2018年 ffq. All rights reserved.
//

#import "JGMessageController.h"
#import "JGOrderMessageController.h"
#import "JGSystemMessageController.h"

@interface JGMessageController ()<ZJScrollPageViewDelegate>
@property (nonatomic, weak) ZJScrollPageView *scrollPageView;
@end

@implementation JGMessageController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"消息";
    //self.navigationItem.title=@"消息";
    [self configSubViews];
}

-(void)configSubViews{

    self.automaticallyAdjustsScrollViewInsets = NO;

    JGOrderMessageController *vc1=[[JGOrderMessageController alloc]init];
    JGSystemMessageController *vc2=[[JGSystemMessageController alloc]init];

    [self addChildViewController:vc1];
    [self addChildViewController:vc2];
    self.scrollPageView.backgroundColor=[UIColor clearColor];
}
#pragma mark - ZJScrollPageView delegate
- (NSInteger)numberOfChildViewControllers {

    return self.childViewControllers.count;
}
- (UIViewController <ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {

    UIViewController<ZJScrollPageViewChildVcDelegate> *childVc = reuseViewController;
    if (!childVc) {
        childVc = self.childViewControllers[index];
    }
    return childVc;
}
#pragma mark - overread
-(UIImage *)lmjNavigationBarLeftButtonImage:(UIButton *)leftButton navigationBar:(LMJNavigationBar *)navigationBar{

    return [UIImage imageNamed:@"mine_icon_return"];
}

#pragma mark - getter setter
- (ZJScrollPageView *)scrollPageView
{
    if(_scrollPageView == nil)
        {
        ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
        //显示滚动条
        style.showLine = YES;
        // 颜色渐变
        style.gradualChangeTitleColor = YES;
        style.animatedContentViewWhenTitleClicked = YES;
        style.autoAdjustTitlesWidth = YES;
        style.selectedTitleColor=MainColor;
        style.normalTitleColor=HEXCOLOR(0xb3b3b3);
        style.scrollLineColor=MainColor;

        ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, self.lmj_navgationBar.height, JGScreenW , JGScreenH-self.lmj_navgationBar.height)segmentStyle:style titles:@[@"订单消息",@"系统消息"] parentViewController:self delegate:self];
        [self.view addSubview:scrollPageView];

        // scrollPageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

        _scrollPageView = scrollPageView;
        }
    return _scrollPageView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




@end
